package ${package.ServiceImpl};

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wwu.common.web.ResultPage;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;

/**
* ${table.comment!}服务实现类
* @author 一蓑烟雨
* @date ${date}
* @version 1.0.0
*/
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
    private final ${table.mapperName} ${table.mapperName?uncap_first};
    @Autowired
    public ${table.serviceImplName}(${table.mapperName} ${table.mapperName?uncap_first}){
    this.${table.mapperName?uncap_first} = ${table.mapperName?uncap_first};
    }

    /**
    * 根据条件分页查询${table.comment}信息
    * @param pageNum: 当前页码
    * @param pageSize: 页码大小
    * @param ${entity} ${entity?uncap_first}: ${table.comment}信息
    * @param dates:  时间范围
    * @return com.wwu.common.web.ResultPage
    * @author 一蓑烟雨
    * @date ${date}
    */
    @Override
    public ResultPage get${entity}ListByPage(Integer pageNum, Integer pageSize, ${entity} ${entity?uncap_first},LocalDate[] dates) {
        //开启分页,查询数据库
        Page<${entity}> page = new Page<>(pageNum, pageSize);
        IPage<${entity}> ${entity?uncap_first}IPage = ${table.mapperName?uncap_first}.get${entity}ListByPage(page,${entity?uncap_first},dates);

        ResultPage resultPage = new ResultPage(${entity?uncap_first}IPage.getTotal(), ${entity?uncap_first}IPage.getRecords());
        return resultPage;
    }
}
</#if>
